package data;

import java.sql.ResultSet;
import java.util.ArrayList;

/**
 *
 * @author Christian Morgan Andersen
 */
public class DBAccess {
    private static MySQLconnection conn = new MySQLconnection();
    private static ResultSet rs;
    
    public static double[][] getInfo(String keywords, int longitude, int latitude, int[] base) {
        rs = conn.executeQuery("SELECT * FROM education_locations WHERE name='" + keywords + "'", "getInfo");
        double[][] result = null;
        ArrayList<double[]> list = new ArrayList<double[]>();
        int count = 0;
        try {
            rs.beforeFirst();
            while(rs.next()) {
                double[] location = new double[2];
                location[0] = rs.getDouble("x");
                location[1] = rs.getDouble("y");
                list.add(location);
                count++;
            }
            result = new double[count][count];
            result = list.toArray(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
}
